/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author tashiba
 */
public class MahasiswaTabelModel extends AbstractTableModel {

    String columNames[] = {"NAMA", "NIM", "NOMOR_EMAIL", "PRODI", "PERIODE"
        + "HARI", "TANGGAL", "DAFTAR_NILAI ", "NASKAH_TA", "BEBASPINJAM_LAB"
        + "BEBASPINJAM_DOSEN", "KP", "TOEFL", "TA"
        + "SISTEM_POIN", "RBM"};
    private ArrayList<Yudisium> data;

    public MahasiswaTabelModel() {
    }

    public MahasiswaTabelModel(ArrayList<Yudisium> data) {
        this.data = data;
    }

    public int getRowCount() {
        return getData().size();
    }

    public int getColumnCount() {
        return columNames.length;
    }

    @Override
    public String getColumnName(int col) {
        return columNames[col];
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        Yudisium temp = (Yudisium) data.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return temp.getNama();
//                return temp.;
            case 1:
                return temp.getNim();
            case 2:
                return temp.getTelpEmail();
            case 3:
                return temp.getProdi();
            case 4:
                return temp.getPeriode();
            case 5:
                return temp.getHari();
            case 6:
                return temp.getTanggal();
            case 7:
                return temp.getDaftarNilai();
            case 8:
                return temp.getNaskahTA();
            case 9:
                return temp.getBebasPinjLab();
            case 10:
                return temp.getBebasPinjDosen();
            case 11:
                return temp.getKP();
            case 12:
                return temp.getToefl();
            case 13:
                return temp.getPengesahanTA();
            case 14:
                return temp.getSistemPoin();
            case 15:
                return temp.getRBM();
        }
        return null;
    }

    public ArrayList<Yudisium> getData() {
        return data;
    }

    public void setData(ArrayList<Yudisium> data) {
        this.data = data;
    }
}
